<div bsModal #createOrEditModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
  aria-labelledby="createOrEditModal" aria-hidden="true" [config]="{ backdrop: 'static' }">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <form *ngIf="active" #editForm="ngForm" novalidate (ngSubmit)="save()" autocomplete="off">
        <div class="modal-header">
          <h4 class="modal-title">
            <span *ngIf="techrule.id">编辑工规</span> <span *ngIf="!techrule.id">测试扫码录入信息</span>
          </h4>
          <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>

        <div class="modal-body">
          <div *ngIf="!techrule.id">
            <div class="row">
              <div class="col-md-4">
                <div class="form-group">
                  <label for="fileCode">文件编号</label>
                  <input id="fileCode" #fileCodeInput="ngModel" type="text" name="fileCode" class="form-control"
                    [(ngModel)]="techrule.techRuleInfo.fileCode" />
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group">
                  <label for="fileName">文件名称</label>
                  <input id="fileName" #fileNameInput="ngModel" type="text" name="fileName" class="form-control"
                    [(ngModel)]="techrule.techRuleInfo.fileName"  />
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group">
                  <label for="modelName">型号</label>
                  <input id="modelName" #modelNameInput="ngModel" type="text" name="modelName" class="form-control"
                    [(ngModel)]="techrule.techRuleInfo.modelName"  />
                </div>
              </div>
            </div>

            <div class="row">
              <div class="col-md-4">
                <div class="form-group">
                  <label for="drawingCode">图号</label>
                  <input id="drawingCode" #drawingCodeInput="ngModel" type="text" name="drawingCode"
                    class="form-control" [(ngModel)]="techrule.techRuleInfo.drawingCode"  />
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group">
                  <label for="drawingName">图号名称</label>
                  <input id="drawingName" #drawingNameInput="ngModel" type="text" name="drawingName"
                    class="form-control" [(ngModel)]="techrule.techRuleInfo.drawingName"  />
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group">
                  <label for="stageType">阶段</label>
                  <input id="stageType" #stageTypeInput="ngModel" type="text" name="stageType" class="form-control"
                    [(ngModel)]="techrule.techRuleInfo.stageType"  />
                </div>
              </div>
            </div>

            <div class="row">
              <div class="col-md-4">
                <div class="form-group">
                  <label for="techRuleType">工艺规程类型</label>
                  <input id="techRuleType" #techRuleTypeInput="ngModel" type="text" name="techRuleType"
                    class="form-control" [(ngModel)]="techrule.techRuleInfo.techRuleType"  />
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group">
                  <label for="isPaper">纸质形式</label>
                  <input id="isPaper" #isPaperInput="ngModel" type="text" name="isPaper" class="form-control"
                    [(ngModel)]="techrule.techRuleInfo.isPaper"  />
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group">
                  <label for="securityType">密级</label>
                  <input id="securityType" #securityTypeInput="ngModel" type="text" name="securityType"
                    class="form-control" [(ngModel)]="techrule.techRuleInfo.securityType"  />
                </div>
              </div>
            </div>

            <div class="row">
              <div class="col-md-4">
                <div class="form-group">
                  <label for="useTime">使用时间</label>
                  <input id="useTime" #useTimeInput="ngModel" type="text" name="useTime" class="form-control"
                    [(ngModel)]="techrule.techRuleInfo.useTime"  />
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group">
                  <label for="useUnit">使用单位</label>
                  <input id="useUnit" #useUnitInput="ngModel" type="text" name="useUnit" class="form-control"
                    [(ngModel)]="techrule.techRuleInfo.useUnit"  />
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group">
                  <label for="fromGist">依据文件</label>
                  <input id="fromGist" #fromGistInput="ngModel" type="text" name="fromGist" class="form-control"
                    [(ngModel)]="techrule.techRuleInfo.fromGist"  />
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-md-12">
                <div class="form-group">
                  <label for="maxLoad">备注</label>
                  <textarea id="remark" class="form-control" type="text" name="remark" [(ngModel)]="techrule.techRuleInfo.remark"
                    rows="3"></textarea>
                </div>
              </div>
            </div>
          </div>
          <div *ngIf="techrule.id">
            当前位置： {{positionName}}
            <div class="row" style="margin-top: 40px;">
              <div class="col-md-4">
                <div class="form-group">
                  <select #areaCombobox name="area" class="form-control" [(ngModel)]="areaId"
                    [attr.data-live-search]="true" jq-plugin="selectpicker" (change)="loadShelfs()" title="选择库房">
                    <option *ngFor="let area of areas" [value]="area.id">{{area.name}}</option>
                  </select>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group">
                  <select #shelfCombobox name="shelf" class="form-control" [(ngModel)]="shelfId"
                    [attr.data-live-search]="true" (change)="loadPositions()" title="选择档案柜">
                    <option *ngFor="let shelf of shelfs" [value]="shelf.id">{{shelf.name}}</option>
                  </select>
                </div>
              </div>
              <div class="col-md-4">
                <div class="form-group">
                  <select #positionCombobox name="position" class="form-control" [(ngModel)]="positionId"
                    jq-plugin="selectpicker" [attr.data-live-search]="true" title="选择架位">
                    <option *ngFor="let position of positions" [value]="position.id">{{position.name}}</option>
                  </select>
                </div>
              </div>
            </div>
          </div>
          <div class="modal-footer">
            <button [disabled]="saving" type="button" class="btn btn-default" (click)="close()">
              {{ l('Cancel') }}
            </button>
            <button type="submit" class="btn btn-primary blue" [disabled]="!editForm.form.valid" [buttonBusy]="saving"
              [busyText]="l('SavingWithThreeDot')">
              <i class="fa fa-save"></i> <span>{{ l('Save') }}</span>
            </button>
          </div>
        </div>
      </form>
    </div>
  </div>
</div>